/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-05-28
 * Time: 13:19
 */
public class Cat extends Animal{

    public Cat(String name) {
        super(name);
    }
    public void eat(){
        System.out.println(name+"在吃猫粮！");
    }

    @Override
    public Animal test() {
        Cat cat=new Cat("小麦");
        return cat;//返回类型为Animal，cat为Cat类型，向上转型
    }
}
